package org.gwu.seuss.server.command;

import org.apache.log4j.Logger;
import org.gwu.seuss.communication.request.ClientRequest;
import org.gwu.seuss.communication.request.ServerResponse;
import org.springframework.util.Assert;

public class ShowStateLogsCommand implements Command {

	static Logger log = Logger.getLogger(ShowStateLogsCommand.class);

	private ClientRequest req;

	public ShowStateLogsCommand(ClientRequest req) {
		this.req = req;
	}

	@Override
	public ServerResponse execute() throws Exception {
		// TODO: These are used over and over.
		// Can we make an abstract class to get rid of the duplicate?
		String username = req.getUsername();
		String password = req.getPassword();

		Assert.hasText(username, "Username is not provided.");
		Assert.hasText(password, "Password is not provided.");

		// TODO: implement
		// 1 - Get Log file

		// 2 - Decrypt Log

		// 3 - send as file
		ServerResponse rep = new ServerResponse();
		rep.setSuccess(true);
		rep.setMessage("Getting state log.");
		// rep.setFileBytes(decFile);
		// rep.setFilename(filename);

		return rep;
	}
}